
import numpy as np
from scipy import io as spio
import matplotlib.pyplot as plt
import pandas as pd
import statsmodels.api as sm
import seaborn as sns


def ss_test():
    nobs = 100
    X = np.random.random((nobs, 2))
    X = sm.add_constant(X)
    beta = [1, .1, .5]
    e = np.random.random(nobs)
    y = np.dot(X, beta) + e
    result = sm.OLS(y, X).fit()
    print(result.summary())


def f(x):
    return x**2+20*np.sin(x)


def plt_test():
    x = np.arange(-10, 10, 0.1)
    plt.plot(x, f(x))
    plt.show()

    N = 1000
    x = np.random.randn(N)
    y = np.random.randn(len(x))
    plt.scatter(x, y)
    plt.show()


def pd_test():
    data = {'A': ['x', 'y', 'z'], 'B': [1, 2, 3], 'C': [1000, 2000, 3000]}
    df = pd.DataFrame(data, index=['a', 'b', 'c'])
    print(df)


if __name__ == '__main__':
    plt_test()
    pd_test()
    ss_test()




